package Day_06;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.event.EventListener;

@Configuration
public class EventConfig implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher applicationEventPublisher;
    @Override

    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher=applicationEventPublisher;
    }
    @EventListener({UpdateUser.class})
    public void UpdateEventListener(UpdateUser event)
    {
        System.out.println("==============事件监听器创建成功");
        System.out.println("=======数据更新"+event);
        System.out.println("=======数据更新 :Source"+event.getSource());
    }

}
